home *** CD-ROM | disk | FTP | other *** search
/ Dr. Health'nstein's Body Fun / bodyfun.iso / mac / MAC MOVIE FOLDER / GYM.DIR / 00499_Script_499 < prev   
Text File  |  1994-10-12  |  6KB  |  207 lines

  1. on startMovie
  2.   StdStartMovie
  3.   
  4.   global GymPoints
  5.   set GymPoints = 0
  6. end startMovie
  7.  
  8. on DoFinal
  9.   DoFinalHelpCard
  10. end
  11.  
  12. on BeforeHelp
  13.   sound stop 1
  14.   sound stop 2
  15. end
  16.  
  17. on AfterHelp
  18. end
  19.  
  20. on DragSlider
  21.   put the clickOn into clickSprite
  22.   put GetSpriteName(clickSprite) into sliderName
  23.   put sliderName & " Range" into rangeName
  24.   put GetSpriteNamed(rangeName) into rangeSprite
  25.   
  26.   put the rect of sprite rangeSprite into theRect
  27.   set rangeWidth = getAt(theRect, 3) - getAt(theRect, 1)
  28.   set rangeHeight = getAt(theRect, 4) - getAt(theRect, 2)
  29.   
  30.   set clickH = getAt(the clickLoc, 1)
  31.   set clickV = getAt(the clickLoc, 2)
  32.   
  33.   if rangeWidth > rangeHeight then
  34.     DragSliderH clickSprite, clickH, getAt(theRect, 1), getAt(theRect, 3)
  35.   else
  36.     DragSliderV clickSprite, clickV, getAt(theRect, 4), getAt(theRect, 2)
  37.   end if
  38.   
  39.   --  global WarningMoviePlayed, WorkoutHours
  40.   --  if WarningMoviePlayed = FALSE and WorkoutHours > GetWarnHours() then
  41.   --    sound stop 1
  42.   --    sound stop 2
  43.   --    set the movieTime of sprite 9 to 0
  44.   --    set the visible of sprite 9 to TRUE
  45.   --    set the movieRate of sprite 9 to 1
  46.   --    set WarningMoviePlayed = TRUE
  47.   --  end if
  48. end
  49.  
  50. on DragSliderH clickSprite, clickH, theL, theR
  51.   put the locH of sprite clickSprite into startH
  52.   
  53.   repeat while the stilldown
  54.     set nextH = startH + the mouseH - clickH
  55.     set nextH = min(theR, nextH)
  56.     set nextH = max(theL, nextH)
  57.     set the locH of sprite clickSprite to nextH
  58.     updateStage
  59.   end repeat
  60.   
  61.   global WorkoutHours
  62.   set thePercentage = (the locH of sprite clickSprite - theL)/float(theR - theL)
  63.   set WorkoutHours =  thePercentage * GetMaxMachineHours()
  64.   put thePercentage && WorkoutHours && GetMaxMachineHours()
  65.   if WorkoutHours <= 5 then
  66.     set WorkoutHours = 0.0
  67.     set the locH of sprite clickSprite to theL
  68.   end if
  69. end
  70.  
  71. on DragSliderV clickSprite, clickV, theB, theT
  72.   put the locV of sprite clickSprite into startV
  73.   
  74.   repeat while the stilldown
  75.     set nextV = startV + the mouseV - clickV
  76.     set nextV = min(theB, nextV)
  77.     set nextV = max(theT, nextV)
  78.     set the locV of sprite clickSprite to nextV
  79.     updateStage
  80.   end repeat
  81.   
  82.   global WorkoutHours
  83.   set thePercentage = (theB - the locV of sprite clickSprite)/float(theB - theT)
  84.   set WorkoutHours =  thePercentage * GetMaxMachineHours()
  85.   --put thePercentage && WorkoutHours && GetMaxMachineHours()
  86.   if WorkoutHours <= 5 then
  87.     set WorkoutHours = 0.0
  88.     set the locV of sprite clickSprite to theB
  89.   end if
  90. end
  91.  
  92. on HideChallengerPictures
  93.   cursor 4
  94.   set the visible of sprite 14 to FALSE
  95.   set the visible of sprite 15 to FALSE
  96.   set the visible of sprite 16 to FALSE
  97.   updateStage
  98. end
  99.  
  100. on SetAwardMovie
  101.   global GymPoints, gMovieMedia
  102.   global WorkoutHours
  103.   
  104.   global gQuad
  105.   SaveWorkoutHistory("GYM " & gQuad & ", " & WorkoutHours)
  106.   
  107.   if WorkoutHours >= (GetFailHours()) then
  108.     set theFile = gMovieMedia & "AD_FAIL.MOV"
  109.     set GymPoints = 0
  110.     SaveExerciseHistory(4)
  111.   else
  112.     if WorkoutHours < GetAwardHours(3) then
  113.       set theFile = gMovieMedia & "AD_AWRD3.MOV"
  114.       set GymPoints = 1  
  115.       SaveExerciseHistory(1)
  116.     else if WorkoutHours < GetAwardHours(2) then
  117.       set theFile = gMovieMedia & "AD_AWRD2.MOV"
  118.       set GymPoints = 2  
  119.       SaveExerciseHistory(2)
  120.     else
  121.       set theFile = gMovieMedia & "AD_AWRD1.MOV"
  122.       set GymPoints = 3  
  123.       SaveExerciseHistory(3)
  124.     end if
  125.   end if
  126.   
  127.   set the fileName of cast "Award Movie" to theFile
  128.   go to frame(the frame + 1)
  129.   set the movieTime of sprite 7 to 0
  130.   set the movieRate of sprite 7 to 1
  131. end
  132.  
  133. on StartStepSlider sliderSprite
  134.   global startH, stopH, deltaH, startV, stopV, deltaV, startTicks, isH
  135.   put the locH of sprite sliderSprite into startH
  136.   put the locV of sprite sliderSprite into startV
  137.   put the ticks into startTicks
  138.   
  139.   put GetSpriteName(sliderSprite) into sliderName
  140.   put sliderName & " Range" into rangeName
  141.   put GetSpriteNamed(rangeName) into rangeSprite
  142.   put the rect of sprite rangeSprite into theRect
  143.   set rangeWidth = getAt(theRect, 3) - getAt(theRect, 1)
  144.   set rangeHeight = getAt(theRect, 4) - getAt(theRect, 2)
  145.   
  146.   if rangeWidth > rangeHeight then
  147.     set isH = TRUE
  148.     set stopH = getAt(theRect, 1)
  149.     set deltaH = float(rangeWidth)/960
  150.   else
  151.     set isH = FALSE
  152.     set stopV = getAt(theRect, 4)
  153.     set deltaV = float(rangeHeight)/960
  154.   end if
  155.   
  156. end
  157.  
  158. on StartWorkoutMovie
  159.   global WorkoutHours
  160.   put the duration of cast (the castNum of sprite 7) into theDur
  161.   if WorkoutHours >= (GetFailHours()) then
  162.     -- make them crash
  163.     set stopIt = integer(theDur)
  164.     set startIt = integer(theDur - (WorkoutHours / GetMaxMachineHours() * 16.0 * 60.0))
  165.     --put startIt && stopIt
  166.   else
  167.     -- no crash
  168.     set startIt = 0
  169.     set stopIt = integer(WorkoutHours / GetMaxMachineHours() * 16.0 * 60.0)
  170.     --put startIt && stopIt
  171.   end if
  172.   
  173.   StartStepSlider 5
  174.   set the startTime of sprite 7 to startIt
  175.   set the movieTime of sprite 7 to startIt
  176.   --set the visible of sprite 7 to TRUE
  177.   set the movieRate of sprite 7 to 1
  178.   set the stopTime of sprite 7 to stopIt
  179. end
  180.  
  181. on StepSlider sliderSprite
  182.   global startH, stopH, deltaH, startV, stopV, deltaV, startTicks, isH
  183.   
  184.   set elapsedTicks = the ticks - startTicks
  185.   
  186.   if isH = TRUE then
  187.     set nextH = startH - (elapsedTicks * deltaH)
  188.     set nextH = max(stopH, nextH)
  189.     set the locH of sprite sliderSprite to nextH
  190.     if nextH = stopH then
  191.       --put elapsedTicks
  192.       set the movieRate of sprite 7 to 0
  193.     else
  194.       go to frame the frame
  195.     end if
  196.   else
  197.     set nextV = startV + (elapsedTicks * deltaV)
  198.     set nextV = min(stopV, nextV)
  199.     set the locV of sprite sliderSprite to nextV
  200.     if nextV = stopV then 
  201.       --put elapsedTicks
  202.       set the movieRate of sprite 7 to 0
  203.     else
  204.       go to frame the frame
  205.     end if
  206.   end if
  207. end